import 'package:flutter/material.dart';
import './Chip_demo.dart';
import './data_table_demo.dart';
import './paginated_data_table_demo.dart';
import './card_demo.dart';
import './stepper_demo.dart';

class ChipIntroDemo extends StatelessWidget {
  const ChipIntroDemo({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Chip Intro'),
        elevation: 0.0,
      ),
      body: ListView(
        children: [
          ItemBuilder(title: 'ChipDemo', page: ChipDemo()),
          ItemBuilder(title: 'DataTableDemo', page: DataTableDemo()),
          ItemBuilder(title: 'PaginatedTableDemo', page: PaginatedDataTableDemo()),
          ItemBuilder(title: 'CardDemo', page: CardDemo()),
          ItemBuilder(title: 'StepperDemo', page: StepperDemo()),
        ],
      ),
    );
  }
}

class ItemBuilder extends StatelessWidget {

  final String title;
  final Widget page;
  
  ItemBuilder({
    this.title,
    this.page
  });

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(title),
      onTap: (){
        Navigator.of(context).push(
          MaterialPageRoute(builder: (BuildContext context)=>page)
        );
      },
    );
  }
}